﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SoulHackerCUnite.Data
{
    public class Demon
    {
        public string Name { get; set; }
        public string RaceJ { get; set; }
        public int Level { get; set; }
        public int UnitePrec { get; set; }
        public string JName { get; set; }
        public string Alias { get; set; }

        public string Skill1 { get; set; }
        public string Skill2 { get; set; }
        public string Skill3 { get; set; }
        public string Skill4 { get; set; }
        public string Skill5 { get; set; }
        public string Skill6 { get; set; }

        public int HeathPoint { get; set; }
        public int ManaPoint { get; set; }

        public string Disposition { get; set; }

        public int Strength { get; set; }
        public int Intelligence { get; set; }
        public int Magic { get; set; }
        public int Stamina { get; set; }
        public int Agility { get; set; }
        public int Luck { get; set; }

        public string InhertType { get; set; }

        private List<string> _skills;

        public List<string> Skills
        {
            get
            {
                if (_skills == null || _skills.Count <= 0)
                {
                    _skills = new List<string>(6);
                    _skills.Insert(0, this.Skill1);
                    _skills.Insert(1, this.Skill2);
                    _skills.Insert(2, this.Skill3);
                    _skills.Insert(3, this.Skill4);
                    _skills.Insert(4, this.Skill5);
                    _skills.Insert(5, this.Skill6);
                    /*_skills[1] = this.Skill2;
                    _skills[2] = this.Skill3;
                    _skills[3] = this.Skill4;
                    _skills[4] = this.Skill5;
                    _skills[5] = this.Skill6;*/
                }
                return _skills;
            }
        }

        public int SkillCount
        {
            get
            {
                if (string.IsNullOrEmpty(this.Skill1))
                    return 0;
                if (string.IsNullOrEmpty(this.Skill2))
                    return 1;
                if (string.IsNullOrEmpty(this.Skill3))
                    return 2;
                if (string.IsNullOrEmpty(this.Skill4))
                    return 3;
                if (string.IsNullOrEmpty(this.Skill5))
                    return 4;
                if (string.IsNullOrEmpty(this.Skill6))
                    return 5;
                return 6;
            }
        }

        public string ExtendName
        {
            get
            {
                return this.Level + " " + this.RaceJ + " " + this.Name;
            }
        }

        public override string ToString()
        {
            return this.Level + " " + this.RaceJ + " " + this.Name;
        }

        public override bool Equals(object obj)
        {
            Demon target = obj as Demon;
            if (target != null)
                return this.Name == target.Name;
            return false;
        }
    }
}
